var VueCommon = {};


VueCommon.alert = function (a) {
    alert("VueCommon" + a)
}
VueCommon.store_setStr = function(kName,str){
    localStorage.setItem(kName,str)
}

VueCommon.store_getStr = function(kName){
    var jsonStr = localStorage.getItem(kName)
    return jsonStr
}

VueCommon.store_setObj = function(kName,obj){
     var jsonStr = JSON.stringify(obj)
    localStorage.setItem(kName,jsonStr)
}

VueCommon.store_getObj = function(kName){
    var jsonStr = localStorage.getItem(kName)
    if (jsonStr) {
        return JSON.parse(jsonStr);
    }
    return {}
}

VueCommon.isEmpty = function(str) {
    if (str === null || str === undefined || str === '') {
        return true
    }
    return false
}

//--------------
VueCommon.isLogin = function(){
    // let uid = VueCommon.store_getStr('uid')
    // if (VueCommon.isEmpty(uid)) {
    //     return false
    // }
    // let pwd = VueCommon.store_getStr('pwd')
    // if (VueCommon.isEmpty(pwd)) {
    //     return false
    // }
    return true
}
VueCommon.saveLogin = function(uid,pwd){
    VueCommon.store_setStr('uid',uid)
    VueCommon.store_setStr('pwd',pwd)
}


module.exports = VueCommon;

